﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace CollectionsLearn
{
    class Program
    {
        static void Main(string[] args)
        {
            keyValuePairs.Add("1","2");
            keyValuePairs.Add("3", "4");

            string[] arrays = keyValuePairs.Select(d => d.Key).ToArray();
            foreach (var value2 in arrays)
            {
                Console.WriteLine(value2);
            }

            


            //string s = "Hello";
            //IEnumerator rator = s.GetEnumerator();
            //while (rator.MoveNext())
            //{
            //    System.Console.WriteLine((char)rator.Current);
            //}
            //Console.Read();
            //ArrayTest();
            //foreach (int i in Power(2, 8))
            //{
            //    Console.Write("{0} ", i);
            //}
            //Console.Read();

            var value = Power(2, 8);
            IEnumerator rator = Power(2, 8).GetEnumerator();

            while (rator.MoveNext())
            {
                System.Console.WriteLine((int)rator.Current);
            }
            Console.Read();
        }

        static void ArrayTest()
        {
            int[] data = { 1, 2, 3 };
            var rator = data.GetEnumerator();
            while (rator.MoveNext())
            {
                System.Console.WriteLine((int)rator.Current);
            }
            Console.Read();
        }

        static IEnumerable Power(int number, int exponent)
        {
            int counter = 0;
            int result = 1;
            while (counter++ < exponent)
            {
                result = result * number;
                yield return result;
            }
        }


       static Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();

  

    }
}
